package com.ruoyi.system.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.StbPolicyMapper;
import com.ruoyi.system.domain.StbPolicy;
import com.ruoyi.system.service.IStbPolicyService;
import com.ruoyi.common.core.text.Convert;

/**
 * 政策条例Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-02-08
 */
@Service
public class StbPolicyServiceImpl implements IStbPolicyService 
{
    @Autowired
    private StbPolicyMapper stbPolicyMapper;

    /**
     * 查询政策条例
     * 
     * @param policyId 政策条例ID
     * @return 政策条例
     */
    @Override
    public StbPolicy selectStbPolicyById(Long policyId)
    {
        return stbPolicyMapper.selectStbPolicyById(policyId);
    }

    /**
     * 查询政策条例列表
     * 
     * @param stbPolicy 政策条例
     * @return 政策条例
     */
    @Override
    public List<StbPolicy> selectStbPolicyList(StbPolicy stbPolicy)
    {
        return stbPolicyMapper.selectStbPolicyList(stbPolicy);
    }

    /**
     * 新增政策条例
     * 
     * @param stbPolicy 政策条例
     * @return 结果
     */
    @Override
    public int insertStbPolicy(StbPolicy stbPolicy)
    {
        stbPolicy.setCreateTime(DateUtils.getNowDate());
        return stbPolicyMapper.insertStbPolicy(stbPolicy);
    }

    /**
     * 修改政策条例
     * 
     * @param stbPolicy 政策条例
     * @return 结果
     */
    @Override
    public int updateStbPolicy(StbPolicy stbPolicy)
    {
        stbPolicy.setUpdateTime(DateUtils.getNowDate());
        return stbPolicyMapper.updateStbPolicy(stbPolicy);
    }

    /**
     * 删除政策条例对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteStbPolicyByIds(String ids)
    {
        return stbPolicyMapper.deleteStbPolicyByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除政策条例信息
     * 
     * @param policyId 政策条例ID
     * @return 结果
     */
    @Override
    public int deleteStbPolicyById(Long policyId)
    {
        return stbPolicyMapper.deleteStbPolicyById(policyId);
    }

	@Override
	public List<Map<String, Object>> selectPolicyContent(StbPolicy stbPolicy) {
		return stbPolicyMapper.selectPolicyContent(stbPolicy);
	}
}
